/* Euclidean bundle adjustment demo using the sba package */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#include "sba.h"

int MAIN__(void) {  return 0; }

static void img_projsKRT_x(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *hx, void *adata)
{ 

}

/* Given a parameter vector p made up of the parameters of m cameras, compute in jac
 * the jacobian of the predicted measurements, i.e. the jacobian of the projections of 3D points in the m images.
 * The jacobian is returned in the order (A_11, ..., A_1m, ..., A_n1, ..., A_nm),
 * where A_ij=dx_ij/db_j (see HZ).
 * Notice that depending on idxij, some of the A_ij might be missing
 *
 */
static void img_projsKRT_jac_x(double *p, struct sba_crsm *idxij, int *rcidxs, int *rcsubs, double *jac, void *adata)
{
 
}

int main(int argc, char *argv[]) {

	int	n = 0, /* number of 3D points */
			m = 0, /* number of cameras */
			mcon = 0;  /* number of cameras whose parameters should not be modified */
	char *vmask; /* point visibility mask */
	double *p; /* initial parameter vector P */
	int cnp = 6, /* number of parameters defining a camera, 3 rotations + focal length */
		  pnp = 3; /* euclidean 3D points */
	double *x, /* measurement vector X */
				 *covx; /* initial estimate? */
	int mnp = 2; /* image points are 2D */
	/*TODO*/int func; /* function computing estimated measure vector */
	/*TODO*/int fjac; /* function evaulating in sparse Jacobian J */
	void *adata; /* pointer to possibly additional data */
	int itmax = 100, /* maximum number of Levenberg-Marquardt iterations */
			verbose = 0; /* verbosity level */
	double *opts; /* minimisation options for Levenberg-Marquardt */
	double *info; /* info regarding outcome of minimisation */

	int	rtn = 0;

  if(argc==4) {
    printf("4 Arguments for no reason\n");
  }
  else {
		printf("Testin'\n");
		rtn = sba_mot_levmar_x(n, m, mcon, vmask, p, cnp, x, covx, mnp,
           img_projsKRT_x,
           img_projsKRT_jac_x,
           NULL, itmax, verbose, opts, info);

/* Example usage: 
        n=sba_mot_levmar_x(numpts3D, nframes, nconstframes, vmask, motstruct, cnp, imgpts, covimgpts, mnp,
                          fixedcal? img_projsRT_x : (havedist? img_projsKDRT_x : img_projsKRT_x),
                          analyticjac? (fixedcal? img_projsRT_jac_x : (havedist? img_projsKDRT_jac_x : img_projsKRT_jac_x)) : NULL,
                          (void *)(&globs), MAXITER, verbose, opts, info);
*/
  }

  return 0;
}

